package com.taoyuan.hotel.controller;

import com.taoyuan.hotel.entity.Food;


import com.taoyuan.hotel.service.intf.FoodService;
import com.taoyuan.hotel.vo.PageBean;
import com.taoyuan.hotel.vo.R;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@RestController
@RequestMapping("/api/food/")
public class FoodController {
    @Autowired
    private FoodService service;

    @PostMapping("save.do")
    public R save(Food food) {return service.save(food);}

    @GetMapping("page.do")
    public PageBean page(int page, int limit) {return service.all(page,limit);}

    @PostMapping("update.do")
    public R update(Food food){return service.update(food);}

    @PostMapping("del.do")
    public R del(int id){return service.del(id);}

    @GetMapping("pagewhere.do")
    public PageBean page(String name,int page,int limit){return service.queryPageWhere(name, page, limit);}

    @PostMapping("delbatch.do")
    public R del(@RequestBody int[] ids){return service.delBatch(ids);}
}
